﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ABELGX
{
    /// <summary>
    /// PageCommon.xaml 的交互逻辑
    /// </summary>
    public partial class PageCommon : Page
    {
        public WindowPG ParentWindow {  get; set; }
        public PageCommon()
        {
            InitializeComponent();
        }

        private void SensorCommon_Click(object sender, RoutedEventArgs e)
        {
            if(ParentWindow == null)
            {
                return;
            }
            ParentWindow.ShowPage(PageViewType.SensorCommon);
        }

        private void SensorAir_Click(object sender, RoutedEventArgs e)
        {
            if (ParentWindow == null)
            {
                return;
            }
            ParentWindow.ShowPage(PageViewType.SensorAir);
        }

        private void Battery_Click(object sender, RoutedEventArgs e)
        {
            if (ParentWindow == null)
            {
                return;
            }
            ParentWindow.ShowPage(PageViewType.Battery);
        }

        private void Driver_Click(object sender, RoutedEventArgs e)
        {
            if (ParentWindow == null)
            {
                return;
            }
            ParentWindow.ShowPage(PageViewType.MotorInfo);
        }

        private void OperationLog_Click(object sender, RoutedEventArgs e)
        {
            ParentWindow.ShowPage(PageViewType.Empty);
            Config.SaveLog();
            System.Diagnostics.Process.Start("explorer.exe", Config.LogFolder);
        }

        private void WarningLog_Click(object sender, RoutedEventArgs e)
        {
            ParentWindow.ShowPage(PageViewType.Empty);
            Config.SaveWarning();
            System.Diagnostics.Process.Start("explorer.exe", Config.WarningFolder);
        }

        private void Video_Click(object sender, RoutedEventArgs e)
        {
            ParentWindow.ShowPage(PageViewType.Empty);
            System.Diagnostics.Process.Start("explorer.exe", Config.VideoFolder);
        }

        private void Parameter_Click(object sender, RoutedEventArgs e)
        {
            if (ParentWindow == null)
            {
                return;
            }
            ParentWindow.ShowPage(PageViewType.Parameter);
        }
    }
}
